<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="https://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8">
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge"/>
    <meta name="viewport" name="viewport"
          content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <title>余额提现</title>  <link rel="icon" href="/template/pc1/images/wmh_favicon.ico" type="image/x-icon" />
    <link href="/template/default/css/style_ky.css" rel="stylesheet"/>
    <link rel="stylesheet" href="/template/default/recouse/css/confirm.css?v=111"/>
    <script type="text/javascript" src="https://static.9hive.cn/global/vendor/jquery/jquery-2.1.4.min.js"></script>
    <link rel="stylesheet" type="text/css" href="http://nsr.9hive.cn/global/vendor/layer/mobile/need/layer.css"/>

    <style>
        body {
            padding-bottom: 55px
        }

        .label_radio input {
            margin-right: 5px;
        }

        .has-js .label_radio {
            padding-left: 26px;
        }

        .has-js .label_radio {
            background-position: 0 0;
            background: url(/template/default/recouse/images/radio_none.png) no-repeat;
            background-size: 16px 16px;
        }

        .has-js label.r_on {
            background-position: 0 0px;
            background: url(/template/default/recouse/images/radio_check.png) no-repeat;
            background-size: 16px 16px;
        }

        .has-js .label_radio input {
            position: absolute;
            left: -9999px;
        }

        .btn-danger {
            color: #ffffff;
            background-color: #d9534f;
            border-color: #d43f3a;
        }

        .btn {
            display: inline-block;
            padding: 6px 12px;
            margin-bottom: 0;
            font-size: 14px;
            font-weight: normal;
            line-height: 1.428571429;
            text-align: center;
            white-space: nowrap;
            vertical-align: middle;
            cursor: pointer;
            background-image: none;
            border: 1px solid transparent;
            border-radius: 4px;
            -webkit-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
            -o-user-select: none;
            user-select: none;
        }

        .money_text {
            font-size: 1.3rem;
            text-indent: 26px;
            margin-top: -40px;
        }

        .infobox {
            border-bottom: 1px solid #ddd;
        }
    </style>

</head>

<body style="min-width: 320px;max-width: 640px;margin:0 auto;background-color: white">
<header>
    <div class="tab_nav">
        <div class="header">
            <div class="h-left"><a class="sb-back" href="javascript:history.back(-1)" title="返回"><img src="/template/default/images/arrow_left_white.png"/></a></div>
            <div class="h-mid">提现</div>
        </div>
    </div>
</header>
<form id="orderInfoForm" name="input" action="/b/order/save" method="post" onsubmit=" return check()">
    <section class="accounts">
        <div class="infobox">

            <%if(!isEmpty(selectCashingBank!)){%>
            <input type="hidden" name="bankId" value="${selectCashingBank.id}"/>
            <p class="address_item"
               onclick="location.href='/b/cashingbank/list?shopId=${shopId!}&returnUrl=/b/tocashing/edit?shopId=${shopId!}'">
                ${selectCashingBank.cardCount!}&nbsp;&nbsp;&nbsp;&nbsp;</br>${selectCashingBank.cardNumber!}&nbsp;
            </p>
            <%}else if(!isEmpty(toCashingBank!)){%>
            <input type="hidden" name="bankId" value="${toCashingBank.id}"/>
            <p class="address_item"
               onclick="location.href='/b/cashingbank/list?shopId=${shopId!}&returnUrl=/b/tocashing/edit?shopId=${shopId!}'">
                ${toCashingBank.cardCount!}&nbsp;&nbsp;&nbsp;&nbsp;</br>${toCashingBank.cardNumber!}&nbsp;
            </p>
            <%}else{%>
            <input type="hidden" name="bankId" value=""/>
            <p class="address_item"
               onclick="location.href='/b/cashingbank/list?shopId=${shopId!}&returnUrl=/b/tocashing/edit?shopId=${shopId!}'">
                银行卡管理
            </p>
            <%}%>
        </div>
        <div class="coin">
            <label style="font-size: 1.7rem;position: relative;">¥</label>
            <input type="number" value="" class="money_text" name="cashAmount" placeholder="可转出到银行卡${deposit!}元"/>
            <input type="hidden" id="leftMoney" value="${deposit!}"/>
        </div>
        <li><input id="submitBtn" value="确认提现" class="money_buttom" readonly/></li>
        <li><a href="/b/tocashing/list?shopId=${shopId!}" class="money_buttom" readonly
               style="background-image: -webkit-linear-gradient(right,#ddd,#ddd)!important;color: #0a0a0a">提现记录</a></li>


        <div style="color: #a3afb7;margin-top: 100px;padding: 0 20px"用户须知：>商家货款、一键推广及销售返点应当在客户确认收货后五个工作日才能到银行帐户</div>
    </section>
</form>

<script src="/template/default/recouse/js/zepto.min.js" type="text/javascript"></script>
<script type="text/javascript" src="http://nsr.9hive.cn/global/vendor/layer/mobile/layer.js"></script>

<script type="text/javascript">
    function toast(msg) {
        layer.open({
            content: msg
            , skin: 'msg',
            anim: 'scale'
            , time: 2 //2秒后自动关闭
        });
    }

    $("#submitBtn").click(function () {
        var bankId = $("input[name='bankId']").val();
        var cashAmount = $("input[name='cashAmount']").val();
        //var reg = /^[1-9]\d*00$/;//100的整数倍
        if (!bankId) {
            toast('银行卡还没选择呢..');
            return;
        }
        if (!cashAmount) {
            toast('提现金额还没填写呢..');
            return;
        }
        if(10>parseFloat(cashAmount)){
            toast('提现金额不能小于10元哦!');
            return;
        }
        /*if (!reg.test(cashAmount)) {
            toast('提现金额必须是10的正整数倍!');
            return;
        }*/
        if (parseInt(cashAmount) > parseInt($('#leftMoney').val())) {
            toast('余额不足!');
            return;
        }
        $.ajax({
            url: "/b/tocashing/save",
            type: 'GET',
            data: {
                "bankId": bankId,
                "cashAmount": cashAmount,
                "shopId": "${shopId!}"
            },
            success: function (data) {
                if (data.code == 1) {
                    toast(data.desc);
                } else if (data.code == 0) {
                    toast('操作成功');
                    setTimeout('window.location.href = "/b/customerCenter?shopId=${shopId!}"', 2000);
                }
            }
        });
    });
</script>
</body>

</html>